[quartz] Remove extra reference on layer's cairo_surface.
authorJohn Ralls <jralls@ceridwen.us>
Thu, 30 Jun 2022 22:27:03 +0000 (15:27 -0700)
committerJohn Ralls <jralls@ceridwen.us>
Thu, 30 Jun 2022 22:27:03 +0000 (15:27 -0700)
gdk/quartz/GdkQuartzView.c
gdk/quartz/gdkwindow-quartz.c

index d35a0c73f1c894f4d81903e5346ea250662dcdeb..af28e37beaf64a18967e4b4c5afc1107fa4d4e2d 100644 (file)
@@ -453,7 +453,7 @@ copy_rectangle_argb32 (cairo_surface_t *dest, cairo_surface_t *source,
 
   cairo_surface_destroy (cvpb_surface);
   cairo_region_destroy (bounds_region);
-  _gdk_quartz_unref_cairo_surface (gdk_window);
+  _gdk_quartz_unref_cairo_surface (gdk_window); // reffed in gdk_window_impl_quartz_begin_paint
   CVPixelBufferUnlockBaseAddress (pixels, 0);
   --impl->in_paint_rect_count;
   self.layer.contents = NULL;
index 9c31f41fd1fc35d4c043b3aa50c3803e2f6bfad6..9f8534e5c159157b4e9da41d5cc9b641b5c9a73f 100644 (file)
@@ -352,7 +352,7 @@ gdk_window_impl_quartz_init (GdkWindowImplQuartz *impl)
 static gboolean
 gdk_window_impl_quartz_begin_paint (GdkWindow *window)
 {
-  gdk_quartz_ref_cairo_surface (window);
+     gdk_quartz_ref_cairo_surface (window); //unreffed in GdkQuartzView::updateLayer
   return FALSE;
 }
 
@@ -1386,6 +1386,7 @@ move_resize_window_internal (GdkWindow *window,
       frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
       [impl->toplevel setFrame:frame_rect display:YES];
       impl->cairo_surface = gdk_quartz_ref_cairo_surface (window);
+      cairo_surface_destroy (impl->cairo_surface); // Remove the extra reference
     }
   else 
     {